window.onload=function(){
    var account=localStorage.getItem('username');
    if(account){
        $('.ava-name').html(account)
    }/*else{
        window.location.href = "login.html";
    }*/
    $(document).on('click','.setting-box a',function(e){
        e.preventDefault();
        $.ajax({
            url:apiDomain+userLogout,
            type:'get',
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success:function(data){
                window.location.href = "login.html";
            }
        })

    })

};

function unlogin(data) {//登录拦截
    if(data.msg==='未登录或登录超时'){
        layer.msg('未登录或登录超时')
        setTimeout(function(){
            // location.href.replace('\w*.html','login.html')
            window.location.href="login.html"
        },1000)
    }
}
/*公用的ip地址*/
var apiDomain='http://101.71.130.40:18080/xinman/';
/*登录接口的地址*/
var login= 'admin/doLogin';
/*获取设备最新信息列表（主监控页面）*/
var indexInformation="/deviceRecord/getLastedDeviceInfoList";
/*记录取消报警日志*/
var indexCancel='log/saveCancelAlarmLog';
/*设置设备监控状态*/
var inferfaceMonitoring='/device/setDevicesWatchStatus';
/*提交设备（修改别名)*/
var inferfaceSubmit='/device/submitDevice';
/*获取设备最新状态列表（配置页面）*/
var inferfaceStatus='/deviceRecord/getLastedDeviceStatusList';
/*获取设备信息列表（数据管理）*/
var datamanagerInfoList='/deviceRecord/getDeviceInfoList';
/*/device/getAllDeviceList获取所有设备列表*/
var dataMangerList='/device/getAllDeviceList';
/*/deviceRecord/getAlarmDeviceInfoList获取报警设备信息列表（数据管理）*/
var dataManerAlarm='/deviceRecord/getAlarmDeviceInfoList';
/*/config/getAllConfigList获取所有配置接口*/
var paramentersConfigList= 'config/getAllConfigList';
/*/config/updateConfig更新配置接口*/
var paramentersUpdate='config/updateConfig';
/*/admin/getUserList 获取用户列表*/
var userList='/admin/getUserList';
/*/admin/updateAdmin修改用户*/
var userUpdte='/admin/updateAdmin';
/*/admin/deleteAdmins批量删除管理员*/
var userDelete='admin/deleteAdmins';
/*/admin/createAdmin 新建用户*/
var userCreate='/admin/createAdmin';
/*/log/getOperateLogList获取操作日志列表*/
var systemOperate='/log/getOperateLogList';
/*/log/getAlarmLogList 获取报警日志列表*/
var systemAlarm='/log/getAlarmLogList';
/*/admin/logout用户推出*/
var userLogout='/admin/logout';